let g:dict_root=$VIM."\\dict"
let g:tags_root=$VIM."\\tags"
let g:php_manual=$VIM."\\php_manual"
let g:svn_root="C:\\Program Files\\TortoiseSVN\\bin"

let g:tynon_web_root="E:\\frgame\\DsFantasy\\web"
let g:tynon_server_root="E:\\frgame\\DsFantasy\\server\\server2"
let g:tynon_client_root="E:\\frgame\\DsFantasy\\client\\dsFantasy"

let s:project_info = [
  \ [ "tynon_web", g:tynon_web_root, "**/*.php **/*.sql" ],
  \ [ "tynon_server", g:tynon_server_root, "**/*.php **/*.sql" ],
  \ [ "tynon_client", g:tynon_client_root, "**/*.as **/*.xml" ],
\ ]

" 取文件所属的项目名
function! g:Project_GetName(fname)
	let l:info = g:Project_GetInfo(fname)
	if l:info != []
		return l:info[0]
	endif
	
	return -1
endfunction

" 取文件所属的项目根路径
function! g:Project_GetPath(fname)
	let l:info = g:Project_GetInfo(fname)
	if l:info != []
		return l:info[1]
	endif
	
	return -1
endfunction

" 取文件所属的项目根路径
function! g:Project_GetFilter(fname)
	let l:info = g:Project_GetInfo(fname)
	if l:info != []
		return l:info[2]
	endif
	
	return -1
endfunction

" 返回文件所属的项目的信息
function! g:Project_GetInfo(fname)
  let l:nums = 0
  while l:nums < len(s:project_info)
    let l:info = s:project_info[l:nums]

    let l:pos = stridx(a:fname, l:info[1])
  	if l:pos > -1
      return l:info
    endif

    let l:nums = l:nums + 1
  endwhile

  return []
endfunction
